<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>OverLay</title>

    <style>
        .btn{
            display: inline-block;
            padding: 6px 12px;
            margin-bottom: 0;
            font-size: 14px;
            font-weight: normal;
            color: #ffffff;
            line-height: 1.42857143;
            text-align: center;
            cursor: pointer;
            border: 1px solid #2e6da4;
            border-radius: 4px;
            background-color:#337ab7;
        }

        .btn:active {
            background-color: #204d74;
        }

        #overlay{
            position: fixed;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: hsla(44, 100%, 0%, .5);
            z-index: 10;
            display: none;
        }

        #overlay-dialog {
            width: 400px;
            height: auto;
            background-color: #ffffff;
            margin: auto;
            border: 1px solid rgba(0, 0, 0, .2);
            border-radius: 6px;

            position: fixed;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -100%);
            z-index: 1060;
        }

        #dialog-header, .dialog-body, .dialog-footer{
            padding: 10px;
            border-bottom:1px solid lightgray;
        }
        
        #dialog-header{
            font-size: 16px;
            color: #000;
            font-weight: bold;
            cursor: move;
        }

        .dialog-footer{
            text-align: right;
        }
    </style>
</head>
<body>
    <h4>浮出层</h4>
    <h4>点击背景透明图层，或者点击取消，关闭浮出层</h4>
    <h4>点击header, 触发拖动</h4>
    <div class="btn" data-target="overlay">显示浮出层</div>

    <div id="overlay">
        <div id="overlay-dialog">
            <div id="dialog-header">header</div>
            <div class="dialog-body">body</div>
            <div class="dialog-footer">
                <div class="btn">确定</div>
                <div class="btn cancel">取消</div>
            </div>
        </div>
    </div>

    <script src="task_2.js"></script>
</body>
</html>